package com.meichis.yndms.vm;

import androidx.lifecycle.MutableLiveData;

import com.meichis.yndms.model.Overview;
import com.meichis.yndms.model.RotateAdv;
import com.meichis.yndms.model.SalesSummary;
import com.meichis.yndms.repository.manager.HomeFragmentManager;
import com.meichis.yndms.repository.manager.LoginRequestManager;

import java.util.List;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-05-08 15:26
 */
public class HomeFragmentVM extends MyViewModel {
    private MutableLiveData<Overview> overview;
    private MutableLiveData<SalesSummary> selectSalesSummary;
    //销售额看板
    private MutableLiveData<List<SalesSummary>> salesSummaryList;
    //销售总额
    private MutableLiveData<Double> sum;
    //本周拜访覆盖率
    private MutableLiveData<String> bzbffgl;
    //轮播图
    private MutableLiveData<RotateAdv> rotateAdv;


    public MutableLiveData<SalesSummary> getSelectSalesSummary() {
        if (selectSalesSummary == null){
            selectSalesSummary = new MutableLiveData<>();
            selectSalesSummary.setValue(new SalesSummary("全部",0));
        }
        return selectSalesSummary;
    }

    public MutableLiveData<Double> getSum() {
        if (sum == null){
            sum = new MutableLiveData<>();
            sum.setValue(0d);
        }
        return sum;
    }

    public MutableLiveData<RotateAdv> getRotateAdv() {
        if (rotateAdv == null) {
            rotateAdv = new MutableLiveData<>();
        }
        return rotateAdv;
    }

    public MutableLiveData<Overview> getOverview() {
        if (overview == null) {
            overview = new MutableLiveData<>();
        }
        return overview;
    }

    public MutableLiveData<List<SalesSummary>> getSalesSummaryList() {
        if (salesSummaryList == null) {
            salesSummaryList = new MutableLiveData<>();
        }
        return salesSummaryList;
    }

    public MutableLiveData<String> getBzbffgl() {
        if (bzbffgl == null) {
            bzbffgl = new MutableLiveData<>();
        }
        return bzbffgl;
    }

    public void GetOverview() {
        HomeFragmentManager.getInstance().GetOverview(getShowDialog(), getUserInfo().getValue().getOrgId(),
                getUserInfo().getValue().getId(), getOverview(), getSalesSummaryList(), getBzbffgl());
    }


    public void GetRotateAdvList(){
        LoginRequestManager.getInstance().GetRotateAdvList(getShowDialog(), getRotateAdv());
    }

}
